package info.zlong.visibleruntime.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import info.zlong.visibleruntime.core.mongo.Mongo;

@Import(MongoConfig.class)
public class Config  {
	@Autowired
	MongoConfig mongoConfig;

	
	@Bean(initMethod = "open", destroyMethod = "close")
	public Mongo getMongoConnector(){
		Mongo connector = new Mongo(mongoConfig.getHosts(), mongoConfig.getUserName(), mongoConfig.getPassword(), mongoConfig.getDatabaseName(), mongoConfig.getCollectionName());
		
		return connector;
	}
 
}